import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';

class TextRichPage01 extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return _TextRichPageState();
  }
}

class _TextRichPageState extends State {
  TapGestureRecognizer _tRecognizer = TapGestureRecognizer();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("TextRich"),
      ),
      body: Center(
        child: Text.rich(
          TextSpan(
            text: "这里是",
            style: TextStyle(),
            children: [
              TextSpan(
                  text: "早起的年轻人",
                  style: const TextStyle(
                    fontWeight: FontWeight.bold,
                    color: Colors.red,
                    fontSize: 18,
                  ),
                  recognizer: TapGestureRecognizer()
                    ..onTap = () {
                      print("--");
                    }),
              TextSpan(text: "的课程"),
            ],
          ),
        ),
      ),
    );
  }
}
